import { createRouter, createWebHistory } from 'vue-router'; 

const routes= [
    {
        path:'/',
        redirect:'/home'
    },
    {
        path:'/home',
        name:'home',
        component:()=>import('../components/layout/index.vue'), //布局页
        children:[
            {
                path:'/index',
                name:'index',
                component:()=>import('../views/index/index.vue'), 
            },
            {
                path:'/monitor',
                name:'monitor',
                component:()=>import('../views/monitor/index.vue'), 
            },
            {
                path:'/order',
                name:'order',
                component:()=>import('../views/order/index.vue'), 
            },
            {
                path:'/census',
                name:'census',
                component:()=>import('../views/census/index.vue'), 
            }
        ]
    }
]

const router = createRouter({
    history:createWebHistory(),
    routes
})

export default router

// history 模式 不带 # 号，跟接近传统 URL